<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Algorithm::Permute - Handy and fast permutation with object oriented interface - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Algorithm-Permute - MetaCPAN" href="https://metacpan.org/dist/Algorithm-Permute/releases.rss" />
        <link rel="canonical" href="./Algorithm::Permute.html" />
        <meta name="description" content="Handy and fast permutation with object oriented interface" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Algorithm::Permute" />
<meta name="twitter:title"       content="Algorithm::Permute" />
<meta name="twitter:description" content="Handy and fast permutation with object oriented interface" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Algorithm::Permute.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Algorithm-Permute was released.">
      <span class="relatize">04 Feb 2023 14:24:22 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Algorithm-Permute">Algorithm-Permute</a>
  </li>
  <li>
    Module version: 0.17
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Algorithm-Permute/source/lib/Algorithm/Permute.pm">Source</a>
    (<a href="https://metacpan.org/dist/Algorithm-Permute/source/lib/Algorithm/Permute.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Algorithm-Permute/source/lib/Algorithm">Browse</a>
    (<a href="https://metacpan.org/dist/Algorithm-Permute/source/lib/Algorithm?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Algorithm-Permute/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Algorithm-Permute/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/iynehz/perl5-Algorithm-Permute">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=Algorithm-Permute">Issues</a>
      (4)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Algorithm-Permute+0.17" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Algorithm-Permute.html?oncpan=1&amp;distmat=1&amp;version=0.17&amp;grade=2" style="color: #090">93</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Algorithm-Permute.html?oncpan=1&amp;distmat=1&amp;version=0.17&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Algorithm-Permute.html?oncpan=1&amp;distmat=1&amp;version=0.17&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/SLOYD/Algorithm-Permute-0.17">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Algorithm-Permute who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 1
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Algorithm-Permute-0.17/index.html">87.18% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Algorithm-Permute/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/S/SL/SLOYD/Algorithm-Permute-0.17.tar.gz">
      Download (<span itemprop="fileSize">72.43KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FSLOYD%2FAlgorithm-Permute-0.17%2Flib%2FAlgorithm%2FPermute.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Algorithm-Permute/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Algorithm-Permute/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Algorithm-Permute">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Algorithm-Permute">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Algorithm/Permute.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="SLOYD/Algorithm-Permute-0.17"
>0.17
  (SLOYD on 2023-02-04)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.16"
>0.16
  (SLOYD on 2017-08-03)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.12"
>0.12
  (EDPRATOMO on 2008-04-23)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.11"
>0.11
  (EDPRATOMO on 2008-01-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.10"
>0.10
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.09"
>0.09
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.08"
>0.08
  (EDPRATOMO on 2007-12-27)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.07"
>0.07
  (EDPRATOMO on 2007-12-26)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.06"
>0.06
  (EDPRATOMO on 2003-05-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="SLOYD/Algorithm-Permute-0.15_01"
>0.15_01 DEV
  (SLOYD on 2017-07-27)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.15"
>0.15
  (SLOYD on 2017-07-11)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.14"
>0.14
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.13"
>0.13
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_005"
>0.12_005 DEV
  (SLOYD on 2017-07-07)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_004"
>0.12_004 DEV
  (SLOYD on 2017-07-06)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_003"
>0.12_003 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_002"
>0.12_002 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_001"
>0.12_001 DEV
  (SLOYD on 2017-07-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.05"
>0.05
  (EDPRATOMO on 2003-05-16)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.04"
>0.04
  (EDPRATOMO on 2002-03-06)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.03"
>0.03
  (EDPRATOMO on 2001-09-05)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.02"
>0.02
  (EDPRATOMO on 2000-09-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.01"
>0.01
  (EDPRATOMO on 1999-10-02)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/SLOYD/Algorithm-Permute-0.17/diff/' + encodeURIComponent(this.value) + '/lib/Algorithm/Permute.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="SLOYD/Algorithm-Permute-0.17"
>0.17
  (SLOYD on 2023-02-04)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.16"
>0.16
  (SLOYD on 2017-08-03)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.12"
>0.12
  (EDPRATOMO on 2008-04-23)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.11"
>0.11
  (EDPRATOMO on 2008-01-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.10"
>0.10
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.09"
>0.09
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.08"
>0.08
  (EDPRATOMO on 2007-12-27)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.07"
>0.07
  (EDPRATOMO on 2007-12-26)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.06"
>0.06
  (EDPRATOMO on 2003-05-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="SLOYD/Algorithm-Permute-0.15_01"
>0.15_01 DEV
  (SLOYD on 2017-07-27)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.15"
>0.15
  (SLOYD on 2017-07-11)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.14"
>0.14
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.13"
>0.13
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_005"
>0.12_005 DEV
  (SLOYD on 2017-07-07)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_004"
>0.12_004 DEV
  (SLOYD on 2017-07-06)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_003"
>0.12_003 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_002"
>0.12_002 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_001"
>0.12_001 DEV
  (SLOYD on 2017-07-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.05"
>0.05
  (EDPRATOMO on 2003-05-16)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.04"
>0.04
  (EDPRATOMO on 2002-03-06)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.03"
>0.03
  (EDPRATOMO on 2001-09-05)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.02"
>0.02
  (EDPRATOMO on 2000-09-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.01"
>0.01
  (EDPRATOMO on 1999-10-02)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Exporter" title="Exporter" class="ellipsis">Exporter</a></li>
  <li><a href="https://metacpan.org/pod/XSLoader" title="XSLoader" class="ellipsis">XSLoader</a></li>
  <li><a href="https://metacpan.org/pod/strict" title="strict" class="ellipsis">strict</a></li>
  <li><a href="https://metacpan.org/pod/warnings" title="warnings" class="ellipsis">warnings</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Algorithm::Permute/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Algorithm%3A%3APermute">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Algorithm-Permute">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/SLOYD/Algorithm-Permute-0.17/view/lib/Algorithm/Permute.pm">This version</a>
    </li>
    <li>
      <a href="./Algorithm::Permute.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/TSIBLEY"><img src="https://www.gravatar.com/avatar/a09cbdbd4c85618a83795f01f7d217af?d=identicon&amp;s=20" title="TSIBLEY" alt="TSIBLEY"></a>
<a class="display-all" href="https://metacpan.org/author/PERLBOY"><img src="https://www.gravatar.com/avatar/8553a87a00c8d2efcd77fb16e6eb73c9?d=identicon&amp;s=20" title="PERLBOY" alt="PERLBOY"></a>
<a class="display-all" href="https://metacpan.org/author/SREZIC"><img src="https://www.gravatar.com/avatar/5fa5a4e5ffdf883a1fcb1840c915d485?d=identicon&amp;s=20" title="SREZIC" alt="SREZIC"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Algorithm-Permute/plussers">3 PAUSE users</a>
</div>
<div>
    3 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-cpan-author="EDPRATOMO"
      data-contrib-email="edpratomo@cpan.org"
    >
      <a href="https://metacpan.org/author/EDPRATOMO" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/8d3f2d1c82495fa0c0a1f7d8b501d6f2?d=identicon&amp;s=20" />
      Edwin Pratomo
      </a>
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/SLOYD" class="author-name">Stephan Loyd</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Algorithm/Permute.pm&#39;" class="">
<option
  selected
  value="SLOYD/Algorithm-Permute-0.17"
>0.17
  (SLOYD on 2023-02-04)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.16"
>0.16
  (SLOYD on 2017-08-03)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.12"
>0.12
  (EDPRATOMO on 2008-04-23)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.11"
>0.11
  (EDPRATOMO on 2008-01-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.10"
>0.10
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.09"
>0.09
  (EDPRATOMO on 2008-01-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.08"
>0.08
  (EDPRATOMO on 2007-12-27)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.07"
>0.07
  (EDPRATOMO on 2007-12-26)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.06"
>0.06
  (EDPRATOMO on 2003-05-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="SLOYD/Algorithm-Permute-0.15_01"
>0.15_01 DEV
  (SLOYD on 2017-07-27)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.15"
>0.15
  (SLOYD on 2017-07-11)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.14"
>0.14
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.13"
>0.13
  (SLOYD on 2017-07-08)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_005"
>0.12_005 DEV
  (SLOYD on 2017-07-07)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_004"
>0.12_004 DEV
  (SLOYD on 2017-07-06)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_003"
>0.12_003 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_002"
>0.12_002 DEV
  (SLOYD on 2017-07-05)</option>
<option
  
  value="SLOYD/Algorithm-Permute-0.12_001"
>0.12_001 DEV
  (SLOYD on 2017-07-04)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.05"
>0.05
  (EDPRATOMO on 2003-05-16)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.04"
>0.04
  (EDPRATOMO on 2002-03-06)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.03"
>0.03
  (EDPRATOMO on 2001-09-05)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.02"
>0.02
  (EDPRATOMO on 2000-09-02)</option>
<option
  
  value="EDPRATOMO/Algorithm-Permute-0.01"
>0.01
  (EDPRATOMO on 1999-10-02)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Algorithm-Permute">Algorithm-Permute-0.17</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage one &#10;
          • 3 direct dependents &#10;          • 3 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Algorithm-Permute-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Algorithm-Permute-0.17">
    <input type="hidden" name="author" value="SLOYD">
    <input type="hidden" name="distribution" value="Algorithm-Permute">
    <button type="submit" class="favorite highlight"><span>6</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Algorithm::Permute.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>6</span> ++</a>
</div>
   / <span>Algorithm::Permute</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Algorithm::Permute.html#NAME">NAME</a></li>
  <li><a href="./Algorithm::Permute.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Algorithm::Permute.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Algorithm::Permute.html#METHODS">METHODS</a></li>
  <li><a href="./Algorithm::Permute.html#CALLBACK-STYLE-INTERFACE">CALLBACK STYLE INTERFACE</a></li>
  <li><a href="./Algorithm::Permute.html#COMPARISON">COMPARISON</a></li>
  <li><a href="./Algorithm::Permute.html#ACKNOWLEDGEMENT">ACKNOWLEDGEMENT</a></li>
  <li><a href="./Algorithm::Permute.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Algorithm::Permute.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Algorithm::Permute.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Algorithm::Permute - Handy and fast permutation with object oriented interface</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  use Algorithm::Permute;

  # default is to create n of n objects permutation generator
  my $p = Algorithm::Permute-&gt;new([&#39;a&#39;..&#39;d&#39;]);

  # but also you can create r of n objects permutation generator, where r &lt;= n
  my $p = Algorithm::Permute-&gt;new([1..4], 3);

  while (my @res = $p-&gt;next) {
    print join(&quot;, &quot;, @res), &quot;\n&quot;;
  }

  # and this one is the speed demon:
  my @array = (1..9);
  Algorithm::Permute::permute { print &quot;@array\n&quot; } @array;</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>This handy module makes performing permutation in Perl easy and fast, although perhaps its algorithm is not the fastest on the earth. It supports permutation r of n objects where 0 &lt; r &lt;= n.</p>

<h1 id="METHODS">METHODS</h1>

<dl>

<dt id="new-[@list]"><a id="new"></a><a id="new--list"></a>new [@list]</dt>
<dd>

<p>Returns a permutor object for the given items.</p>

</dd>
<dt id="next">next</dt>
<dd>

<p>Returns a list of the items in the next permutation. The order of the resulting permutation is the same as of the previous version of <code>Algorithm::Permute</code>.</p>

</dd>
<dt id="peek">peek</dt>
<dd>

<p>Returns the list of items which <b>will be returned</b> by next(), but <b>doesn&#39;t advance the sequence</b>. Could be useful if you wished to skip over just a few unwanted permutations.</p>

</dd>
<dt id="reset">reset</dt>
<dd>

<p>Resets the iterator to the start. May be used at any time, whether the entire set has been produced or not. Has no useful return value.</p>

</dd>
</dl>

<h1 id="CALLBACK-STYLE-INTERFACE"><a id="CALLBACK"></a>CALLBACK STYLE INTERFACE</h1>

<p>Starting with version 0.03, there is a function - not exported by default - which supports a callback style interface:</p>

<dl>

<dt id="permute-BLOCK-ARRAY"><a id="permute"></a>permute BLOCK ARRAY</dt>
<dd>

<p>A block of code is passed, which will be executed for each permutation. The array will be changed in place, and then changed back again before <code>permute</code> returns. During the execution of the callback, the array is read-only and you&#39;ll get an error if you try to change its length. (You <i>can</i> change its elements, but the consequences are liable to confuse you and may change in future versions.)</p>

<p>You have to pass an array, it can&#39;t just be a list. It <b>does</b> work with special arrays and tied arrays, though unless you&#39;re doing something particularly abstruse you&#39;d be better off copying the elements into a normal array first. Example:</p>

<pre><code> my @array = (1..9);
 permute { print &quot;@array\n&quot; } @array;</code></pre>

<p>The code is run inside a pseudo block, rather than as a normal subroutine. That means you can&#39;t use <code>return</code>, and you can&#39;t jump out of it using <code>goto</code> and so on. Also, <code>caller</code> won&#39;t tell you anything helpful from inside the callback. Such is the price of speed.</p>

<p>The order in which the permutations are generated is not guaranteed, so don&#39;t rely on it.</p>

<p>The low-level hack behind this function makes it currently the fastest way of doing permutation among others.</p>

</dd>
</dl>

<h1 id="COMPARISON">COMPARISON</h1>

<p>I&#39;ve collected some Perl routines and modules which implement permutation, and do some simple benchmark. The whole result is the following.</p>

<p>Permutation of <b>eight</b> scalars:</p>

<pre><code>  Abigail&#39;s                     :  9 wallclock secs ( 8.07 usr +  0.30 sys =  8.37 CPU)
  Algorithm::Permute            :  5 wallclock secs ( 5.72 usr +  0.00 sys =  5.72 CPU)
  Algorithm::Permute qw(permute):  2 wallclock secs ( 1.65 usr +  0.00 sys =  1.65 CPU)
  List::Permutor                : 27 wallclock secs (26.73 usr +  0.01 sys = 26.74 CPU)
  Memoization                   : 32 wallclock secs (32.55 usr +  0.02 sys = 32.57 CPU)
  perlfaq4                      : 36 wallclock secs (35.27 usr +  0.02 sys = 35.29 CPU)</code></pre>

<p>Permutation of <b>nine</b> scalars (the Abigail&#39;s routine is commented out, because it stores all of the result in memory, swallows all of my machine&#39;s memory):</p>

<pre><code>  Algorithm::Permute            :  43 wallclock secs ( 42.93 usr +  0.04 sys = 42.97 CPU)
  Algorithm::Permute qw(permute):  15 wallclock secs ( 14.82 usr +  0.00 sys = 14.82 CPU)
  List::Permutor                : 227 wallclock secs (226.46 usr +  0.22 sys = 226.68 CPU)
  Memoization                   : 307 wallclock secs (306.69 usr +  0.43 sys = 307.12 CPU)
  perlfaq4                      : 272 wallclock secs (271.93 usr +  0.33 sys = 272.26 CPU)</code></pre>

<p>The benchmark script is included in the bench directory. I understand that speed is not everything. So here is the list of URLs of the alternatives, in case you hate this module.</p>

<ul>

<li><p>Memoization is discussed in chapter 4 Perl Cookbook, so you can get it from O&#39;Reilly: ftp://ftp.oreilly.com/published/oreilly/perl/cookbook</p>

</li>
<li><p>Abigail&#39;s: http://www.foad.org/~abigail/Perl</p>

</li>
<li><p>List::Permutor: http://www.cpan.org/modules/by-module/List</p>

</li>
<li><p>The classic way, usually used by Lisp hackers: perldoc perlfaq4</p>

</li>
</ul>

<h1 id="ACKNOWLEDGEMENT">ACKNOWLEDGEMENT</h1>

<p>In Edwin&#39;s words: Yustina Sri Suharini - my ex-fiance-now-wife, for providing the permutation problem to me.</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<ul>

<li><p><b>Data Structures, Algorithms, and Program Style Using C</b> - Korsh and Garrett</p>

</li>
<li><p><b>Algorithms from P to NP, Vol. I</b> - Moret and Shapiro</p>

</li>
</ul>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Edwin Pratomo &lt;edpratomo@cpan.org&gt; was the original author.</p>

<p>Stephan Loyd &lt;sloyd@cpan.org&gt; is co-maintainer after version 0.12.</p>

<p>The object oriented interface is taken from Tom Phoenix&#39;s <code>List::Permutor</code>. Robin Houston &lt;robin@kitsite.com&gt; invented and contributed the callback style interface.</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>This software is copyright (c) 1999 by Edwin Pratomo.</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Algorithm::Permute, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Algorithm::Permute</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Algorithm::Permute</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Algorithm::Permute.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
